Direct memory access (DMA) allows hardware devices in a computer to access system memory for reading and/or writing independently of the central processing unit (CPU). Hardware devices that are capable of performing DMA include disk drive controllers, graphics cards, network cards and sound cards. While a hardware device is performing the DMA, the CPU can engage in other operations. DMA is especially useful in real-time computing applications where it is critical to avoid the stalling of concurrent operations.
A computer having DMA-capable devices often uses an input/output memory management unit (IOMMU) to manage address translations. In a virtual machine system, the guest operating system of a virtual machine usually does not know the host physical address that it accesses. Instead, the virtual machine system operates using virtualized guest physical addresses. Typically, it is unlikely that all of the virtual machines will use all of their respectively allocated memory at the same time, and the host system may allocate more virtual memory to the virtual machines than what the host system actually has in the physical memory. As a result, some of the allocated memory may be swapped out to a secondary data storage when it is not in use for a period of time. With conventional DMA systems, if a device is assigned to a guest operating system of a virtual machine and performs DMA to an address not currently resident in the memory, an error can occur. Most devices in traditional DMA system cannot recover from such errors and handling the error recovery in real time incurs significant overhead that degrades the performance of the system.